import Book from "../../models/book";
import Person from "../../models/person";

export default {
    Query: {
        allBook: async () => {
            return Book.findAll({ include: [{ model: Person, as: "person" }] });
        }
    },
    Mutation: {
        addBook: async (context: any, { name, pageSize, userId }:
            { name: string, pageSize: number, userId: number }) => {
            return await Book.create({
                name, pageSize, userId
            });
        }
    }
};
